<?xml version="1.0" encoding="UTF-8"?>
 <grammar xmlns="http://relaxng.org/ns/structure/1.0">
  <start>
   <element name="library">
    <oneOrMore>
     <element name="book">
      <attribute name="id"/>
      <attribute name="available"/>
      <element name="isbn">
       <text/>
      </element>
      <element name="title">
       <attribute name="xml:lang"/>
       <text/>
      </element>
      <oneOrMore>
       <element name="author">
        <ref name="common-content"/>
        <optional>
         <element name="died">
          <text/>
         </element>
        </optional>
       </element>
      </oneOrMore>
      <zeroOrMore>
       <element name="character">
        <ref name="common-content"/>
        <element name="qualification">
         <text/>
        </element>
       </element>
      </zeroOrMore>
     </element>
    </oneOrMore>
   </element>
  </start>
  <define name="common-content">
   <attribute name="id"/>
   <element name="name">
    <text/>
   </element>
   <optional>
    <element name="born">
     <text/>
    </element>
   </optional>
  </define>
 </grammar>
